package com.six.goods.controller;

import com.six.core.entity.Deposit;
import com.six.core.vo.Result;
import com.six.goods.service.DepositService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: whj
 * @Version 1.0
 * @Date: 2023/2/28  9:11
 */

@RestController
@RequestMapping("/goods/deposit")
public class DepositController {
    @Autowired
    private DepositService depositService;

    /**
     * 存储--分页查询
     * @param currentPage
     * @param pageSize
     * @param deposit
     * @return
     */
    @PostMapping("/seledeposit")
    @ResponseBody
    public Result seledeposit(@RequestParam(defaultValue = "1")Integer currentPage, @RequestParam(defaultValue = "5")Integer pageSize, @RequestBody Deposit deposit){
        return depositService.seleAllDeposit(currentPage,pageSize,deposit);
    }

    /**
     * 储存--添加
     * @param deposit
     * @return
     */
    @PostMapping("/insertdeposit")
    @ResponseBody
    public Result insertdeposit(@RequestBody Deposit deposit){
        return depositService.insertDeposit(deposit);
    }

    /**
     * 储存--删除
     * @param id
     * @return
     */
    @DeleteMapping("/deletedeposit")
    @ResponseBody
    public Result deletedeposit(Integer id){
        return depositService.deleteDeposit(id);
    }

    /**
     * 储存--修改
     * @param deposit
     * @return
     */
    @PutMapping("/updatedeposit")
    @ResponseBody
    public Result updatedeposit(@RequestBody Deposit deposit){
        return depositService.updateDeposit(deposit);
    }

    //下拉框
    @PostMapping("/selectDeposit")
    public Result selectDeposit(){
        return depositService.selectDeposit();
    }

    //下拉框
    @PostMapping("/selectDepositname")
    public Deposit selectDepositname(@RequestBody Deposit deposit){
        return depositService.selectDepositname(deposit);
    }
}
